package com.mnyc.controller;

import com.mnyc.http.FeignServerrClient;
import com.mnyc.service.FeignServerService;
import com.mnyc.service.FeignTestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("client")
@Import(FeignClientsConfiguration.class)
public class ClientController {

    @Autowired
    FeignServerService feignServerService;
    @Autowired
    FeignTestService feignTestService;

    @GetMapping("get")
    public String getFunc(String name) {
        feignServerService.get();
        feignTestService.get();
        return "get";
    }


    @GetMapping("post")
    public String postFunc(String name) {
        feignServerService.post();
        feignTestService.post();
        return "post";
    }

    @GetMapping("put")
    public String putFunc(String name) {
        feignServerService.put();
        feignTestService.put();
        return "put";
    }

    @GetMapping("delete")
    public String deleteFunc(String name) {
        feignServerService.delete();
        feignTestService.delete();
        return "delete";
    }

    @GetMapping("path")
    public String pathFunc(String name) {
        feignServerService.path();
        feignTestService.path();
        return "delete";
    }

}
